package com.example.cloud.service;

import com.example.cloud.config.GRpcService;

import io.grpc.stub.StreamObserver;

@GRpcService
public class GreeterService extends GreeterGrpc.GreeterImplBase {

    @Override
    public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
        HelloReply.Builder replyBuilder = HelloReply.newBuilder()
            .setMessage("你好 " + request.getName());
        System.out.println("==========" + request.getName());
        responseObserver.onNext(replyBuilder.build());
        responseObserver.onCompleted();
    }
}